package com.newviews.tcmip.config;


import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * 替换 EnableScheduling 作用
 * 由配置文件读取是否开启定时任务--scheduler.enable
 *
 * @author ChenLong
 */
@Configuration
public class SchedulerCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        return Boolean.parseBoolean(context.getEnvironment().getProperty("scheduler.enable"));
    }
}

